package com.union.core.sys.service;

import java.util.List;

import org.apache.log4j.Logger;

import com.union.core.sys.dao.PublicSentimentModuleDao;
import com.union.core.sys.dao.impl.PublicSentimentModuleDaoImpl;

import com.union.core.sys.model.PublicSentimentModule;

/**
 * 业务逻辑处理类:系统模块
 * filename: PublicSentimentModuleService.java
 * project:  CCTR
 * @company Hainan Jowe Technology Ltd
 * @author wull
 * @create in 2012-10-31
 * @version 1.0
 */
public class PublicSentimentService{
	
	private static Logger log = Logger.getLogger(PublicSentimentService.class.getName());
	private PublicSentimentModuleDao publicSentimentModuleDaoImpl;
	
	public PublicSentimentService(){
		publicSentimentModuleDaoImpl = new PublicSentimentModuleDaoImpl();
	}
	
	
	public boolean addSysModule(PublicSentimentModule publicSentimentModule){
    	publicSentimentModule.setSTATUS(1);
    	boolean flag = publicSentimentModuleDaoImpl.addModule(publicSentimentModule);
    	log.info("添加舆情模块: "+publicSentimentModule.getPUBSENTM_NAME()+"flag="+flag);
    	return flag;
	}
	
	public int getPubSentListCount(String startDate,String endDate,int status,int dealType,int orgId,int staffId,int queryType,String queryData)
	{
    	int counnt = publicSentimentModuleDaoImpl.getPubSentListCount(startDate,endDate,status,dealType,orgId,staffId,queryType,queryData);
    	log.info("查询记录数=["+counnt+"]");
		return counnt;
	}
	public List<PublicSentimentModule> getPubSentList(String startDate,String endDate,int status,int dealType,int orgId,int staffId,int queryType,String queryData,int start, int PageSize)
	{
    	List<PublicSentimentModule> pubSenttList = publicSentimentModuleDaoImpl.getPubSentList(startDate,endDate,status,dealType,orgId,staffId,queryType,queryData,start,PageSize);
    	log.info("查询数据");
		return pubSenttList;
	}
	
	
	public PublicSentimentModule getPublicSentimentModuleById(int publicSentId)
	{
		log.info("查询模块数据");
		return publicSentimentModuleDaoImpl.getPublicSentimentModuleById(publicSentId);
	}
	

	
	
	public boolean deleteModule(int pubSentId)
	{
		if(publicSentimentModuleDaoImpl.deleteModule(pubSentId))
		{
			log.info("删除舆情成功!");
			return true;
		}
		else
		{
			log.info("删除舆情失败!");
			return false;
		}
		
	}
	
	public boolean beianModule(int pubSentId)
	{
		if(!publicSentimentModuleDaoImpl.beianModule(pubSentId))
		{
			log.info("备案舆情失败!");
			return false;
		}
		else
		{
			log.info("备案舆情成功!");
			return true;
		}
		
	}
	
}
